<%@ page language="java" contentType="text/html; charset=UTF-8"
	pageEncoding="UTF-8"%>
<%@ taglib prefix="spring" uri="http://www.springframework.org/tags"%>
<%@ taglib prefix="form" uri="http://www.springframework.org/tags/form"%>
<%@ taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c"%>
<%@ taglib uri="http://java.sun.com/jsp/jstl/functions" prefix="fn"%>
<div class="mainbar">
	<div class="page-head">
		<h2 class="pull-left">
			<i class="icon-table"></i>
			<spring:message code="menu.listSlider.label" />
		</h2>
		<div class="clearfix"></div>
	</div>
	<div class="matter">
		<div class="container-fluid">

			<!-- Table -->

			<div class="row-fluid">

				<div class="span12">

					<div class="widget">

						<div class="widget-head">
							<div class="pull-left">
								<spring:message code="menu.listSlider.label" />
							</div>
							<div class="pull-right">
								<a href="${pageContext.request.contextPath}/admin/getAddSlider"
									class="btn btn-mini btn-success"> <i class="icon-pencil"></i>
									<spring:message code="menu.addSlider.label" /></a>

							</div>

							<div class="clearfix"></div>
						</div>

						<div class="widget-content">

							<table id="adminTable"
								class="table table-striped table-bordered table-hover">

								<thead>
									<tr>
										<th colspan="7">Album: <select name="album"
											onchange="getListAlbum(this);" id="albumList">
												<c:forEach items="${albumList}" var="album">
													<c:choose>
														<c:when test="${chooseAlbum.id == album.id }">
															<option value="${album.id}" selected>
																<c:out value="${album.name}" />
															</option>
														</c:when>
														<c:otherwise>
															<option value="${album.id}">${album.name}</option>
														</c:otherwise>
													</c:choose>

												</c:forEach>

										</select></th>
									</tr>
									<tr>
										<th style="width: 20px">#</th>

										<th style="width: 200px;"><spring:message
												code="menu.sliderName.label" /></th>
										<th style="width: 200px;"><spring:message code="image.table.header.image" /></th>
									
										<th style="width: 100px;"><spring:message code="menu.isShow.label" /></th>
										<th style="width: 100px"><spring:message
												code="menu.control.label" /></th>

									</tr>
								</thead>

								<tbody>
									<c:forEach items="${imageList}" var="image" varStatus="count">
										<tr>
											<td>${count.count}</td>
											<td><c:out value="${image.name}" /></td>
											<td><img
												src="../resources/${fn:toLowerCase(image.imageType)}-images/${image.name}"
												style="width: 100px; height: 100px" /></td>
											<td><c:choose>
													<c:when test="${image.isShow == true}">
														<a id="showbutton${image.id}" style="width: 3px;"
															onclick="return confirmDeactive('Image', ${image.id});">Hiển
															Thị</a>

													</c:when>
													<c:otherwise>
														<a id="showbutton${image.id}" style="width: 3px;"
															onclick="return confirmDeactive('Image', ${image.id});">Không
															Hiển Thị</a>

													</c:otherwise>
												</c:choose></td>
											<td>
												<form action="getUpdateSlider" method="get"
													style="width: 50px; float: left">
													<button type="submit" class="btn btn-mini btn-warning">
														<i class="icon-pencil"></i>
														<spring:message code="menu.edit.label" />
													</button>
													<input type="hidden" value="${image.id}" name="imageId">
												</form> <%-- 												<form action="deleteAlbumImage" method="get"> --%>
												<button onclick="confirmDelete('Image', ${image.id})"
													class="btn btn-mini  btn-danger">
													<i class="icon-pencil"></i>
													<spring:message code="menu.delete.label" />
												</button> <%-- 													<input type="hidden" value="${image.id}" name="imageId"> --%>
												<%-- 												</form> --%>
											</td>
										</tr>
									</c:forEach>
								</tbody>

							</table>

						</div>
						<div class="widget-foot"></div>
					</div>
				</div>
			</div>
		</div>
	</div>
</div>